#include<bits/stdc++.h>
using namespace std;
int n;
int du[1000011],fa[1000011];
vector<int> v[1000011];
void DFS(int p,int f)
{
	fa[p] = f;
	for(auto i:v[p]) if(i != f)
	{
		DFS(i,p);
	}
}
priority_queue<int> q;
int ans[1000011],idx;
int x,y;
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("choice.in","r",stdin);
	freopen("choice.out","w",stdout);
	cin >> n;
	for(int i = 1;i < n;i++)
	{
		cin >> x >> y;
		v[x].push_back(y),v[y].push_back(x);
		du[x]++,du[y]++;
	}
	DFS(1,1);
	for(int i = 1;i <= n;i++)
	{
		if(du[i] == 1 && i != 1)
		{
			q.push(i);
		}
	}
	while(!q.empty())
	{
		int p = q.top();
		q.pop();
		ans[++idx] = p;
		if(p == 1) break;
		du[fa[p]]--;
		if(du[fa[p]] <= 1) q.push(fa[p]);
	}
	while(idx) cout << ans[idx--] << " ";
	return 0;
}
